package com.charzhan.seven;

import com.charzhan.utiles.rabbitmqutil;
import com.rabbitmq.client.Channel;
import com.sun.scenario.effect.impl.sw.sse.SSEBlend_SRC_OUTPeer;

import java.nio.charset.StandardCharsets;
import java.util.HashMap;
import java.util.Map;

public class emitLog {
    public static final String EXCHANGE_NAME="topic_logs";
    public static void main(String[] args)  throws  Exception{
        Channel channel = rabbitmqutil.getChannel();
        HashMap<String, String> stringStringHashMap = new HashMap<>();
        /*

        quick.orange.rabbit 被队列 Q1Q2 接收到
        lazy.orange.elephant 被队列 Q1Q2 接收到
        quick.orange.fox 被队列 Q1 接收到
        lazy.brown.fox 被队列 Q2 接收到
        lazy.pink.rabbit 虽然满足两个绑定但只被队列 Q2 接收一次
        quick.brown.fox 不匹配任何绑定不会被任何队列接收到会被丢弃
        quick.orange.male.rabbit 是四个单词不匹配任何绑定会被丢弃
        lazy.orange.male.rabbit 是四个单词但匹配 Q2
         */
        stringStringHashMap.put("quick.orange.rabbit","被队列 Q1Q2 接收到");
        stringStringHashMap.put("lazy.orange.elephant","被队列 Q1Q2 接收到");
        stringStringHashMap.put("quick.orange.fox","被队列 Q1 接收到");
        stringStringHashMap.put("lazy.brown.fox","被队列 Q2 接收到");
        stringStringHashMap.put("lazy.pink.rabbit","虽然满足两个绑定但只被队列 Q2 接收一次");
        stringStringHashMap.put("quick.brown.fox","不匹配任何绑定不会被任何队列接收到会被丢弃");
        stringStringHashMap.put("quick.orange.male.rabbit","是四个单词不匹配任何绑定会被丢弃");
        stringStringHashMap.put("lazy.orange.male.rabbit","是四个单词但匹配 Q2");
//        stringStringHashMap.put("","");
        for (Map.Entry<String, String> key : stringStringHashMap.entrySet()) {
             channel.basicPublish(EXCHANGE_NAME, key.getKey(), null,key.getValue().getBytes(StandardCharsets.UTF_8));
            System.out.println("sc");
        }

    }
}
